
Originally Posted by
DoubleKill
Code:
for(local.i = 1;local.i <= local.array.size;local.i++)
{
local.static = spawn script_model model "static/indycrate.tik";
local.static.origin = local.array[local.i][1];
local.static.angles = local.array[local.i][2];
local.static solid;
local.static nodamage;
local.n = 2
local.tr[local.n] = spawn trigger_multiple
local.tr[local.n].origin = ( local.array[local.i][1] )
local.tr[local.n] setsize ( -10 -10 -10 ) ( 10 10 10 )
local.tr[local.n] setthread tr
local.n++
}
The above makes no sense because variable n will be set to 2 every time. You actually don't need to keep a list of the triggers if you use the same targetname for each one.
And to iterate over your triggers, simply do
This has the advantage that the game is now responsible for managing this array. If you spawn a new entity with this targetname, it will be added to the array. If you remove an entity with this targetname, it will be also removed from the array.

Originally Posted by
DoubleKill
On the trigger you have to always put a different targetname if not when someone shot in one of the objects is going to remove all the objects at the same time.
If you delete them by using their targetname, this would be true. However, self refers to the trigger entity in the thread called by the trigger, so you can just do this: